package com.forenow.oop;

/**
 * 构造器的重载（overload）:调用构造器的时候会根据传入的参数决定调用哪一个构造器
 */
public class OverloadDemo {
    public OverloadDemo(){
        System.out.println("sjdfhskjdfhsdfjdlskflkdsfj");
    }
    public OverloadDemo(int a){
        System.out.println(a);
    }
    public OverloadDemo(String s,Double a){
        System.out.println(s+","+a);
    }
    //方法重载
    public int add(int a,int b){
        return a+b;
    }
    public int add(int a,int b,int c){
        return a+b+c;
    }

    public static void main(String[] args) {
        OverloadDemo overloadDemo = new OverloadDemo("abc",3.14);
    }
}
